<template>
  <el-dialog class="img-viewer" width="30%" :visible.sync="visible" :before-close="handleClose">
    <div slot="title" class="justify-start align-center">
      <div class="title main-title fz-18">{{ value.title }}</div>
      <div class="dateTime fz-14 mg-left-10 third-title">{{ value.dateTime | dateTimeFormatter }}</div>
    </div>
    <img :src="value.fileId|imageFormat" class="img-view">
  </el-dialog>
</template>

<script>
export default {
  name: 'ImgViewer',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    value: {
      type: Object,
      default: () => ({ title: '', dateTime: '', fileId: '' })
    }
  },
  methods: {
    handleClose() {
      this.$emit('update:visible', false)
    }
  }
}
</script>

<style scoped lang="scss">
.img-viewer {
  .img-view {
    width: 100%;
    height: vh(300px);
  }
}
</style>
